<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let arr = new Array(2, 6, 1, 77, 52, 25, 7)
        let newarr = new Array()
        let max = arr[0]
        let min = arr[0]
        for (let i = 0; i < arr.length; i++) {
            //每一项都去对比 如果大于则不进入判断执行下面代码
            if (!(max > arr[i])) {
                max = arr[i]
            }
            //每一项都去对比 如果小于则不进入判断执行下面代码
            if (!(min < arr[i]))
                min = arr[i]
        }
        console.log(max);
        console.log(min);
    </script>
</body>

</html>